// Copyright 2022 a.o.smith ALL Rights Reserved
package com.liuxinlong.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * 固资项目状态枚举
 *
 * @author liuxinlong@hotwater.com.cn
 * @version 1.0.0
 * @since 2023-12-18
 */
public enum AssetsStatusEnum {
    PLAN(1, "plan"),
    APPROVED_PENDING(2, "approved pending"),
    APPROVED(3, "approved"),
    CARRYOVER(4, "carryover"),
    CANCEL(5, "cancel"),
    CLOSED(6, "closed");

    private int value;

    private String name;

    AssetsStatusEnum(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public String getName() {
        return name;
    }


    public static String getNameByValue(int value) {
        AssetsStatusEnum arrObj[] = AssetsStatusEnum.values();
        for (AssetsStatusEnum obj : arrObj) {
            if (value == obj.getValue()) {
                return obj.getName();
            }
        }
        return " ";
    }

    public static int getValueByName(String name) {
        AssetsStatusEnum arrObj[] = AssetsStatusEnum.values();
        for (AssetsStatusEnum obj : arrObj) {
            if (StringUtils.equals(name, obj.getName())) {
                return obj.getValue();
            }
        }
        return 0;
    }
}
